package com.efast.cafe.portal.service.company.impl;

import java.util.Date;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.efast.cafe.framework.jdbc.JdbcDao;
import com.efast.cafe.framework.jdbc.JdbcDaoImpl;
import com.efast.cafe.framework.jdbc.persistence.Criteria;
import com.efast.cafe.portal.entity.company.PortalCompanyRegister;
import com.efast.cafe.portal.service.company.IPortalCompanyRegisterActivateCodeService;

/******************************************************************************
 * @File name   :      PortalCompanyRegisterActivateCodeServiceImpl.java
 *
 * @Author      :      fxm
 *
 * @Date        :      2016-6-28
 *
 * @Copyright Notice: 
 * Copyright (c) 2016 Efast Serv. All  Rights Reserved.
 * This software is published under the terms of the Efast Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * 2016-6-28 下午8:51:02        fxm     1.0            Initial Version
 *****************************************************************************/
@Service
@Transactional
public class PortalCompanyRegisterActivateCodeServiceImpl implements
		IPortalCompanyRegisterActivateCodeService {

	@Qualifier("jdbcDao")
	@Autowired
	private  JdbcDao  jdbcDao;
	


	
	
	/**
	 * {@inheritDoc} 
	 * overridden:
	 * @Date        :      2016-6-28
	 * @see org.eae.eldf.portal.remote.company.PortalCompanyRegisterActivateCodeService#updateCompanyRegisterActivateCode(java.lang.String, java.lang.Long)
	 **/
	@Override
	@Transactional(propagation=Propagation.REQUIRES_NEW)
	public void updateCompanyRegisterActivateCode(String activate_code,Date nextDate,
			Long portal_company_register_id) {
		jdbcDao.update(Criteria
				.create(PortalCompanyRegister.class)
				.set("activate_code", activate_code).set("activate_valid_time", nextDate)
				.where("portal_company_register_id",
						new Object[] {portal_company_register_id }));
	}

}
